<?php
class ShoesController extends Controller
{
    var $name = 'Shoes';
    var $uses = array('Shoe');
    
    function index(){

            $bota = $this -> Shoe -> find(all);
            $this -> set ('bota', $bota);

    }
    function detail($id){
        if (is_numeric($id)){
            $conds = array('Shoe.id'=> $id);
            $result = $this ->Shoe ->fint('all', array('conditions'=>$conds));
            $this ->set('detail', $result);
        }
        else{
            header("Location: suchapa3/bitwa2/bi/cakephp/index.php/shoes/index");

        }

    }
    function add(){
        $barvicky = array(
            0 => "zelena",
            1 => "cervena",
            2=> "cerna",
            3=> "bila",
            4=> "modra"
        );
        $typboty = array(
            0 => "lodicky",
            1 => "botasky",
            2 => "sandale",
            3 => "bagancata"
        );
        $podpatky = array(
            0 => "ano",
            1 => "ne"
        );
        $vazani = array(
            'tkanicky',
            'zip',
            'bez niceho'
        );
        $this->set('barvicky', $barvicky);
        $this->set('typboty', $typboty);
        $this->set('podpatky', $podpatky);
        $this->set('vazani', $vazani);
        debug($this->data);
        $this->Shoe->save($this->data);
        if(isset($this->data['Shoe']['barva'])){
            $this->data['Shoe']['barva']=$barvicky[$this->data['Shoe']['barva']];
            $this->data['Shoe']['vazani']=$vazani[$this->data['Shoe']['vazani']];
            $this->data['Shoe']['typ']=$typboty[$this->data['Shoe']['typ']];
            $this->data['Shoe']['podpatky']=$podpatky[$this->data['Shoe']['podpatky']];
        }
    }


}
?>


